Step 3: Send the Data

Now that you have a Recordset, you need to send it to the client by saving it as XML to the ASP Response object. Add the following code to the bottom of XMLResponse.asp.

  Response.Write "<?xml version='1.0' encoding='ISO-8859-1'?>" & vbCRLF
  rstCustomers.save Response, adPersistXML
  rstCustomers.Close
%>

Notice that the ASP Response object is specified as the destination for the Recordset Save method. The destination of the Save method can be any object that supports the IStream interface such as an ADO Stream object, or a file name that includes the complete path to which the Recordset is to be saved.

Save and close XMLResponse.asp before going to the next step.

Next   Step4: Receive the Data